#include "ui_controllerconfig.h"
#include <SDL.h>
#include "pch.h"

class ControlsConfig : public QDialog, private Ui::configcontrol
{

	Q_OBJECT

public:
	ControlsConfig();

	int getKey();
	void keyPressEvent(QKeyEvent *ev);
	void refreshView();
	void handlebutton( QPushButton *pb ,int &i);
	void parseCfgFile();


public slots:
	void bgreen_released();
	void bred_released();
	void byellow_released();
	void bblue_released();
	void borange_released();
	void bstrumup_released();
	void bstrumdown_released();
	void bstart_released();
	void bselect_released();
	void brock_released();
	void playercombo_activated(int );
	void joycombo_activated(int );
	void cancel_released();
	void OK_released();

protected:

private:

	typedef enum {NONE,JOYSTICK,KEYBOARD} CONTROLERTYPE;

	typedef struct
	{
		CONTROLERTYPE type;
		int joynum;
		int playerid;
		int green;
		int red;
		int yellow;
		int blue;
		int orange;
		int strumup;
		int strumdown;
		int start;
		int select;
		int rock;
		QString green_str;
		QString red_str;
		QString yellow_str;
		QString blue_str;
		QString orange_str;
		QString strumup_str;
		QString strumdown_str;
		QString start_str;
		QString select_str;
		QString rock_str;
	}CONTROLDATA;

	SDL_Joystick *m_active_joystick;
	int m_active_player;
	CONTROLDATA m_controls[2];
	QPushButton *m_inputbutton;



};